/**
 * Company
 * Copyright (C) 2004-2018 All Rights Reserved.
 */
package com.idefav.springdemo2.aop.interceptors;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;

/**
 * @author wuzishu
 * @version $Id AopInterceptor.java, v 0.1 2018-07-22 下午3:48 wuzishu Exp $$
 */
public class AopInterceptor {
    public void before(JoinPoint joinPoint){
        System.out.println("前置通知");
    }
    public void after(JoinPoint joinPoint){
        System.out.println("后置通知");
    }

    public void afterReturn(JoinPoint joinPoint){
        System.out.println("后置返回通知");
    }
    public void exception(JoinPoint joinPoint,Throwable ex){
        System.out.println("异常通知");
    }
    public Object around(ProceedingJoinPoint joinPoint){
        Object result=null;
        System.out.println("进入环绕通知");
        try {
            result=joinPoint.proceed();
            System.out.println("环绕退出");
        } catch (Throwable throwable) {
            System.out.println("环绕异常");
            throwable.printStackTrace();
        }
        return result;
    }
}
